//
// IUT de Nice / Departement informatique / Module APO Java
// Annee 2011_2012
//
// Projet Himalaya
//
// Classe Region - Tests unitaires des accesseurs
//                  
// Auteur : T. Cazorla & Y. Seree
// Version 1.0.0
//

import java.util.ArrayList;
import java.util.LinkedHashMap;

public class T_Region_N2 {

   public static void main (String[] args) {

      Tests.Begin("_Himalaya.Region", "1.0.0");

  		ArrayList<Village> village = new ArrayList<Village>();
	
  		Village v1 = new Village("a");
  		Village v2 = new Village("b");
  		Village v3 = new Village("c");
  	
  		village.add(v1);
  		village.add(v2);
  		village.add(v3);

  		ArrayList<Village> village2 = new ArrayList<Village>();
  	
  		Village v4 = new Village("e");
  		Village v5 = new Village("f");
  		Village v6 = new Village("g");
  	
  		village2.add(v4);
  		village2.add(v5);
  		village2.add(v6);
      
         Tests.Design("Controle des accesseurs", 3); {

            Tests.Case("getM_nbDelegation"); {
            	
            	LinkedHashMap<String, Integer> Delegation = new LinkedHashMap<String, Integer>();
            	Delegation.put("Bleu", new Integer(4));
            	Delegation.put("Rouge", new Integer(2));
            	Delegation.put("Vert", new Integer(2));
            	Delegation.put("Blanc", new Integer(3));
            	Delegation.put("Jaune", new Integer(0));
        		Delegation.put("Violet", new Integer(7));
            	
            	Region r1 = new Region(9, village);
            	Region r2 = new Region(9, village2, Delegation);
            	
            	Tests.Unit("{Bleu=0, Rouge=0, Vert=0, Blanc=0, Jaune=0, Violet=0}",  r1.getM_nbDelegation().toString());
			 	Tests.Unit("{Bleu=4, Rouge=2, Vert=2, Blanc=3, Jaune=0, Violet=7}",  r2.getM_nbDelegation().toString());
            }

            Tests.Case("setM_nbDelegation"); {
            	
                Region r1 = new Region(8, village);
                Region r2 = new Region(2, village2);
                
                r1.setM_nbDelegation("Vert", 5);
                r2.setM_nbDelegation("Rouge", 6);
                
            	Tests.Unit("Region [numero=8, villages=[a, b, c], Delegation={Bleu=0, Rouge=0, Vert=5, Blanc=0, Jaune=0, Violet=0}]",   r1.toString());
                Tests.Unit("Region [numero=2, villages=[e, f, g], Delegation={Bleu=0, Rouge=6, Vert=0, Blanc=0, Jaune=0, Violet=0}]",   r2.toString());
            }
            
            Tests.Case("getM_posseder"); {
            	
            	LinkedHashMap<String, Integer> Delegation = new LinkedHashMap<String, Integer>();

            	Delegation.put("Bleu", new Integer(4));
            	Delegation.put("Rouge", new Integer(2));
            	Delegation.put("Vert", new Integer(2));
            	Delegation.put("Blanc", new Integer(3));
            	Delegation.put("Jaune", new Integer(0));
        		Delegation.put("Violet", new Integer(7));      	
            	
                Region r1 = new Region(8, village);
                Region r2 = new Region(2, village2);
                Region r3 = new Region(9, village2, Delegation);
                Region r4 = new Region(7, village);
                
                r1.setM_nbDelegation("Vert", 5);
                r2.setM_nbDelegation("Rouge", 6);
                
            	Tests.Unit("Vert",   r1.getM_posseder());
                Tests.Unit("Rouge",  r2.getM_posseder());
                Tests.Unit("Violet", r3.getM_posseder());
                Tests.Unit(null,  r4.getM_posseder());

            }
            
            Tests.Case("getM_numero"); {
                Region r1 = new Region(8, village);
                Region r2 = new Region(2, village2);

            	Tests.Unit(8,   r1.getM_numero());
                Tests.Unit(2,   r2.getM_numero());
            }
            Tests.Case("getM_villages"); {
                Region r1 = new Region(8, village);
                Region r2 = new Region(2, village2);

            	Tests.Unit("[a, b, c]",   r1.getM_villages().toString());
                Tests.Unit("[e, f, g]",   r2.getM_villages().toString());
            }
         }
      Tests.End();
   }
}

